#pragma config(Hubs,  S1, HTMotor,  HTMotor,  none,     none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Motor,  mtr_S1_C1_1,     leftFront,     tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C1_2,     leftRear,      tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_1,     rightFront,    tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S1_C2_2,     rightRear,     tmotorTetrix, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#pragma debuggerWindows("joystickGame");

#include "JoystickDriver.c"

task main()
{
	int deadZone = 15;
	waitForStart() ;
	while(true)
	{
		getJoystickSettings(joystick);

		// Left Motor Control //
		if(abs(joystick.joy1_y1) > deadZone)
		{
			motor[leftFront] = joystick.joy1_y1;
			motor[leftRear] = joystick.joy1_y1;
		}
		else
		{
			motor[leftFront] = 0;
			motor[leftRear] = 0;
		}

		// Right Motor Control //
		if(abs(joystick.joy1_y2) > deadZone)
		{
			motor[rightFront] = joystick.joy1_y2;
			motor[rightRear] = joystick.joy1_y2;
		}
		else
		{
			motor[rightFront] = 0;
			motor[rightRear] = 0;
		}
	}
}
